Skip to content

feat(providers): add Command Code preset with live model discovery - #923

Merged
Wibias merged 3 commits into
devfrom
codex/909-commandcode-provider
Aug 3, 2026
Merged

feat(providers): add Command Code preset with live model discovery#923
Wibias merged 3 commits into
devfrom
codex/909-commandcode-provider

Conversation

@Wibias

@Wibias Wibias commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds a commandcode registry preset: OpenAI-compatible openai-chat provider at https://api.commandcode.ai/provider/v1, API-key auth, dashboard link, and live model discovery from the public /provider/v1/models catalog (51 models, slash-namespaced ids preserved, context windows parsed). Default model: deepseek/deepseek-v4-flash, also seeded as the cold-start fallback so a discovery failure never empties the catalog for a fresh config.
  • The model catalog is unauthenticated, so the key-login flow cannot prove a key valid. The preset opts into apiKeyValidation: "unknown" so validation reports "couldn't validate (may still work)" instead of a false positive; the docs now state validation is provider-specific.
  • Docs (en/ja/ko/ru/zh-cn) gain the Command Code row and a discovery note, and preset counts are now correct: 69 built-in presets (58 key, 7 OAuth, 3 local, 1 forward), matching PROVIDER_REGISTRY.

Validation

  • bun run typecheck — pass
  • bun test tests/commandcode-provider.test.ts tests/provider-registry-parity.test.ts — 39 pass, 0 fail (includes the new discovery-failure fallback regression test)
  • bun run test — 7561 tests; 14 fail, all reproduced identically on the upstream dev tip (Windows symlink EPERM + a cmd-shim spawn assertion), unrelated to this change
  • bun run privacy:scan — pass
  • Live GET https://api.commandcode.ai/provider/v1/models — 200, 51 rows (fixture snapshot); POST /provider/v1/chat/completions without a key returns 401 UNAUTHORIZED with an official error-docs link

Primary-source evidence (per MAINTAINERS.md / contributing)

  • Endpoints: vendor API reference at https://commandcode.ai/docs/provider; chat completions endpoint verified live (401 without Bearer, documented error page); /provider/v1/models is public by design — verified 200 with and without a key, so there is no authenticated models endpoint to cite for this provider (the entry's liveModels reads the public catalog).
  • Terms / legal entity: Command Code (terms: https://commandcode.ai/terms); schema.org org data names Command Code, San Francisco CA, founded 2024.
  • Routing authorization: Command Code operates the Provider API as its official programmatic surface; it is not a third-party reseller preset — model availability is governed by Command Code's own plan terms.
  • Maintenance owner: @Wibias (provider/CI maintainer per MAINTAINERS.md) — updates land through the existing provider-registry review flow.
  • Verification date: 2026-08-03 (live endpoint probes + fixture capture).

Review notes

  • The OAuth/CLI-login flow (issue item 3, marked optional) is deferred; docs and the registry note now state that CLI auth bridging for Go/Pro subscriptions is not yet available.
  • preserveCustomDestination: true keeps the registry from retargeting an existing same-named custom provider, including the local-bridge workaround from the issue.
  • The public catalog reports ids/context windows only; reasoningEfforts: [] keeps unknown models off Codex's fallback ladder until Command Code publishes a per-model reasoning contract.
  • The apiKeyValidation field overlaps with open PR feat(providers): add SambaNova and Nebius presets #870 (SambaNova/Nebius), which introduces the same policy; whichever lands second needs only a trivial rebase.

Limitations

  • Plan-gated failures (403 MODEL_NOT_IN_PLAN) are passed through from upstream; no client-side per-plan filtering is applied.
  • Chat-endpoint behavior was verified only to the authentication boundary (401 without key); an end-to-end completion with a Provider-plan key was not exercised.

Fixes #909

Summary by CodeRabbit

  • New Features
    • Added Command Code as a provider with model discovery, authentication, routing, and subscription guidance.
    • Added support for providers whose API keys cannot be validated automatically.
  • Documentation
    • Updated built-in provider preset totals from 68 to 69 across supported languages.
    • Documented Command Code setup, model availability, authentication behavior, and plan requirements.
  • Tests
    • Added coverage for Command Code discovery, routing, authentication, model handling, and fallback behavior.

@github-actions github-actions Bot added the enhancement New feature or request label Aug 3, 2026
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The provider registry adds Command Code with key authentication, OpenAI-compatible routing, bounded live model discovery, and unknown API-key validation. Tests cover configuration, discovery, routing, fallback behavior, and parity. English and localized documentation update provider counts and Command Code usage details.

Changes

Command Code provider

Layer / File(s) Summary
Provider metadata and registry wiring
src/providers/registry.ts, src/providers/derive.ts, src/oauth/key-providers.ts
The registry supports apiKeyValidation: "unknown". Command Code uses the fixed Provider API endpoint, bearer authentication, bounded live model discovery, and a seeded default model.
Discovery, routing, fallback, and parity validation
tests/fixtures/commandcode-models.json, tests/commandcode-provider.test.ts, tests/provider-registry-parity.test.ts
Tests cover configuration, seed data, unknown key validation, bounded catalog discovery, bearer requests, slash-preserving model IDs, chat routing, fallback behavior, and registry parity.
Localized provider documentation
docs-site/src/content/docs/getting-started/quickstart.md, docs-site/src/content/docs/guides/providers.md, docs-site/src/content/docs/ja/..., docs-site/src/content/docs/ko/..., docs-site/src/content/docs/ru/..., docs-site/src/content/docs/zh-cn/...
Documentation updates the built-in preset count to 69 and documents Command Code endpoints, discovery limits, authentication behavior, and plan requirements.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant OpenCodex
  participant CommandCodeModels
  participant CommandCodeChat
  OpenCodex->>CommandCodeModels: GET /provider/v1/models
  CommandCodeModels-->>OpenCodex: Return bounded model catalog
  OpenCodex->>CommandCodeChat: POST /provider/v1/chat/completions with bearer key
  CommandCodeChat-->>OpenCodex: Return OpenAI-compatible completion
Loading

Possibly related issues

Possibly related PRs

  • lidge-jun/opencodex#406 — Shares provider discovery and metadata propagation across the registry and derived provider configuration.
  • lidge-jun/opencodex#652 — Introduces the bounded model-discovery contract used by this provider.
  • lidge-jun/opencodex#747 — Adds a live-discovered OpenAI-compatible provider with bounded discovery, tests, and multilingual documentation.

Suggested reviewers: ingwannu, lidge-jun

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the primary change: adding the Command Code provider preset with live model discovery.
Linked Issues check ✅ Passed The PR implements the required registry, API-key auth, endpoint, live discovery, fallback, and namespaced IDs; optional OAuth remains deferred [#909].
Out of Scope Changes check ✅ Passed All code, tests, registry metadata, and translated documentation changes directly support the Command Code provider objectives [#909].
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/909-commandcode-provider

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs-site/src/content/docs/guides/providers.md`:
- Line 193: Update the catalog introduction in
docs-site/src/content/docs/guides/providers.md:193-193 and its translations in
docs-site/src/content/docs/ja/guides/providers.md:122-122,
docs-site/src/content/docs/ko/guides/providers.md:122-122,
docs-site/src/content/docs/ru/guides/providers.md:129-129, and
docs-site/src/content/docs/zh-cn/guides/providers.md:114-114 to state that key
validation is provider-specific and Command Code keys are reported as
unverifiable.
- Around line 277-283: Update the Command Code provider documentation to remove
or explicitly mark the Go/Pro CLI auth bridge as not yet available in
docs-site/src/content/docs/guides/providers.md lines 277-283,
docs-site/src/content/docs/ja/guides/providers.md lines 200-206,
docs-site/src/content/docs/ko/guides/providers.md lines 200-206,
docs-site/src/content/docs/ru/guides/providers.md lines 209-215, and
docs-site/src/content/docs/zh-cn/guides/providers.md lines 188-193, preserving
the remaining authentication guidance in each locale.

In `@src/providers/registry.ts`:
- Line 1195: Update the note in the provider registry entry to state that API
access requires the Provider plan and that CLI auth bridging for Go/Pro
subscribers is not yet available; remove wording that implies the bridge
currently provides access.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1a0bbdd9-4bae-4a47-bb65-d54620045ecb

📥 Commits

Reviewing files that changed from the base of the PR and between fa51fce and adae0d9.

📒 Files selected for processing (16)
  • docs-site/src/content/docs/getting-started/quickstart.md
  • docs-site/src/content/docs/guides/providers.md
  • docs-site/src/content/docs/ja/getting-started/quickstart.md
  • docs-site/src/content/docs/ja/guides/providers.md
  • docs-site/src/content/docs/ko/getting-started/quickstart.md
  • docs-site/src/content/docs/ko/guides/providers.md
  • docs-site/src/content/docs/ru/getting-started/quickstart.md
  • docs-site/src/content/docs/ru/guides/providers.md
  • docs-site/src/content/docs/zh-cn/getting-started/quickstart.md
  • docs-site/src/content/docs/zh-cn/guides/providers.md
  • src/oauth/key-providers.ts
  • src/providers/derive.ts
  • src/providers/registry.ts
  • tests/commandcode-provider.test.ts
  • tests/fixtures/commandcode-models.json
  • tests/provider-registry-parity.test.ts

Comment thread docs-site/src/content/docs/guides/providers.md Outdated
Comment thread docs-site/src/content/docs/guides/providers.md
Comment thread src/providers/registry.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: adae0d925d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/providers/registry.ts
Comment thread docs-site/src/content/docs/guides/providers.md Outdated
Comment thread docs-site/src/content/docs/guides/providers.md Outdated
Comment thread src/providers/registry.ts
- Seed the default model so discovery failure never empties the catalog
- Correct preset counts in all locales (69: 58 key, 7 OAuth, 3 local, 1 forward)
- State key validation is provider-specific (Command Code: unverifiable)
- Drop the not-yet-available CLI auth bridge claim; add docs URL + verification date

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docs-site/src/content/docs/guides/providers.md (1)

278-284: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Document the complete Command Code provider contract in every locale.

The five sections describe discovery and Bearer authentication, but they do not explicitly document key authentication with openai-chat, POST {baseUrl}/chat/completions, or the unavailability of OAuth/CLI bridging.

  • docs-site/src/content/docs/guides/providers.md#L278-L284: add the openai-chat adapter, POST \https://api.commandcode.ai/provider/v1/chat/completions\``, and explicit OAuth/CLI bridge-unavailable wording.
  • docs-site/src/content/docs/ja/guides/providers.md#L201-L207: add the equivalent Japanese details.
  • docs-site/src/content/docs/ko/guides/providers.md#L201-L207: add the equivalent Korean details.
  • docs-site/src/content/docs/ru/guides/providers.md#L210-L216: add the equivalent Russian details.
  • docs-site/src/content/docs/zh-cn/guides/providers.md#L188-L193: add the equivalent Simplified Chinese details.

As per path instructions, provider documentation must match actual CLI/API behavior and document the Command Code openai-chat contract.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs-site/src/content/docs/guides/providers.md` around lines 278 - 284,
Update the Command Code provider sections in
docs-site/src/content/docs/guides/providers.md (278-284),
docs-site/src/content/docs/ja/guides/providers.md (201-207),
docs-site/src/content/docs/ko/guides/providers.md (201-207),
docs-site/src/content/docs/ru/guides/providers.md (210-216), and
docs-site/src/content/docs/zh-cn/guides/providers.md (188-193) to document the
openai-chat adapter, key-authenticated POST
https://api.commandcode.ai/provider/v1/chat/completions requests, and explicitly
state that OAuth/CLI authentication bridging is unavailable; provide equivalent
localized wording in each translated section while preserving the existing
discovery and Bearer-auth details.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs-site/src/content/docs/guides/providers.md`:
- Around line 193-196: Make the built-in provider breakdown explicitly state one
default ChatGPT-forward preset while preserving totals of 69, 58 key-based, 7
OAuth, 3 local, and 1 ChatGPT-forward: update
docs-site/src/content/docs/guides/providers.md lines 193-196,
docs-site/src/content/docs/ru/guides/providers.md lines 129-132, and
docs-site/src/content/docs/zh-cn/guides/providers.md lines 114-116 with each
locale’s equivalent of an explicit count of one.

---

Outside diff comments:
In `@docs-site/src/content/docs/guides/providers.md`:
- Around line 278-284: Update the Command Code provider sections in
docs-site/src/content/docs/guides/providers.md (278-284),
docs-site/src/content/docs/ja/guides/providers.md (201-207),
docs-site/src/content/docs/ko/guides/providers.md (201-207),
docs-site/src/content/docs/ru/guides/providers.md (210-216), and
docs-site/src/content/docs/zh-cn/guides/providers.md (188-193) to document the
openai-chat adapter, key-authenticated POST
https://api.commandcode.ai/provider/v1/chat/completions requests, and explicitly
state that OAuth/CLI authentication bridging is unavailable; provide equivalent
localized wording in each translated section while preserving the existing
discovery and Bearer-auth details.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 5eca9229-02ec-4a59-aa5d-0a34beb41b87

📥 Commits

Reviewing files that changed from the base of the PR and between adae0d9 and 11a0e09.

📒 Files selected for processing (12)
  • docs-site/src/content/docs/getting-started/quickstart.md
  • docs-site/src/content/docs/guides/providers.md
  • docs-site/src/content/docs/ja/getting-started/quickstart.md
  • docs-site/src/content/docs/ja/guides/providers.md
  • docs-site/src/content/docs/ko/getting-started/quickstart.md
  • docs-site/src/content/docs/ko/guides/providers.md
  • docs-site/src/content/docs/ru/getting-started/quickstart.md
  • docs-site/src/content/docs/ru/guides/providers.md
  • docs-site/src/content/docs/zh-cn/getting-started/quickstart.md
  • docs-site/src/content/docs/zh-cn/guides/providers.md
  • src/providers/registry.ts
  • tests/commandcode-provider.test.ts

Comment thread docs-site/src/content/docs/guides/providers.md Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docs-site/src/content/docs/guides/providers.md (1)

278-284: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Document the openai-chat adapter in every Command Code guide.

The three guides document the endpoint and authentication behavior but leave the provider’s adapter implicit. Add the openai-chat adapter name in each Command Code section.

  • docs-site/src/content/docs/guides/providers.md#L278-L284: state that Command Code uses the openai-chat adapter.
  • docs-site/src/content/docs/ru/guides/providers.md#L210-L216: state that Command Code uses the openai-chat adapter.
  • docs-site/src/content/docs/zh-cn/guides/providers.md#L188-L193: state that Command Code uses the openai-chat adapter.

As per path instructions, document Command Code as a key-based provider using the openai-chat adapter.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs-site/src/content/docs/guides/providers.md` around lines 278 - 284,
Document Command Code as a key-based provider using the openai-chat adapter in
docs-site/src/content/docs/guides/providers.md lines 278-284,
docs-site/src/content/docs/ru/guides/providers.md lines 210-216, and
docs-site/src/content/docs/zh-cn/guides/providers.md lines 188-193; update each
Command Code section while preserving its existing endpoint and authentication
details.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@docs-site/src/content/docs/guides/providers.md`:
- Around line 278-284: Document Command Code as a key-based provider using the
openai-chat adapter in docs-site/src/content/docs/guides/providers.md lines
278-284, docs-site/src/content/docs/ru/guides/providers.md lines 210-216, and
docs-site/src/content/docs/zh-cn/guides/providers.md lines 188-193; update each
Command Code section while preserving its existing endpoint and authentication
details.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 15ad58a4-e293-4c0a-9201-c39148442e84

📥 Commits

Reviewing files that changed from the base of the PR and between 11a0e09 and ad4eb58.

📒 Files selected for processing (3)
  • docs-site/src/content/docs/guides/providers.md
  • docs-site/src/content/docs/ru/guides/providers.md
  • docs-site/src/content/docs/zh-cn/guides/providers.md

@Wibias

Wibias commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator Author

[shipping-github] Merge

Why it helps: commandcode becomes a first-class key provider - OpenAI-compatible Chat Completions at the official Provider API, live model discovery from the public 51-model catalog, honest unverifiable key validation, and a cold-start fallback seed so the default stays callable when discovery fails. Docs updated in all five locales; preset counts now match the registry (69: 58 key, 7 OAuth, 3 local, 1 forward).

Fixes #909.

@Wibias
Wibias merged commit 0fd775a into dev Aug 3, 2026
19 checks passed
@Wibias
Wibias deleted the codex/909-commandcode-provider branch August 3, 2026 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant